From e6d75576c8b8657482c613a5256216a94c09bece Mon Sep 17 00:00:00 2001 From: robertl Date: Tue, 30 Aug 2005 17:33:28 +0000 Subject: [PATCH] Honour both style of coordinate conventions when reading PCX. --- pcx.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pcx.c b/pcx.c index 4fe7f42d6..244ada7e8 100644 --- a/pcx.c +++ b/pcx.c @@ -27,6 +27,7 @@ static FILE *file_in; static FILE *file_out; static void *mkshort_handle; static char *deficon = NULL; +static int read_as_degrees; #define MYNAME "PCX" @@ -81,6 +82,7 @@ data_read(void) int n; char lathemi, lonhemi; + read_as_degrees = 0; for(;fgets(ibuf, sizeof(ibuf), file_in);) { switch (ibuf[0]) { @@ -102,8 +104,13 @@ data_read(void) if (latdir == 'S') lat = -lat; if (londir == 'W') lon = -lon; - wpt_tmp->longitude = ddmm2degrees(lon); - wpt_tmp->latitude = ddmm2degrees(lat); + if (read_as_degrees) { + wpt_tmp->longitude = lon; + wpt_tmp->latitude = lat; + } else { + wpt_tmp->longitude = ddmm2degrees(lon); + wpt_tmp->latitude = ddmm2degrees(lat); + } waypt_add(wpt_tmp); break; case 'H': @@ -160,6 +167,9 @@ data_read(void) track_add_head(track_head); } route_add_wpt(track_head, wpt_tmp); + case 'U': + read_as_degrees = ! strncmp("LAT LON DEG", ibuf + 3, 11); + break; default: ; } -- 2.30.2